using System;

namespace AndyPike.Experiments.Fluent
{
    public static class GuardAgainst
    {
        public static void ArgumentNull(object param, string paramName)
        {
            if (param == null)
                throw new ArgumentNullException(paramName);
        }

        public static void ArgumentNullOrEmpty(string param, string paramName)
        {
            if (param == null)
                throw new ArgumentNullException(paramName);

            if (param == string.Empty)
                throw new ArgumentException(string.Format("The parameter {0} cannot be empty.", paramName), paramName);
        }

        public static void ArgumentOutsideRange(int param, string paramName, int floor, int ceiling)
        {
            if(param < floor || param > ceiling)
                throw new ArgumentException(string.Format("The parameter {0} must be between {1} and {2} (inclusive).", paramName, floor, ceiling), paramName);
        }
    }
}